<template>
  <div>
    <input placeholder="输入关键字搜索" @keyup.enter="selectData" v-model="selectText">
    <MyTable :data="sickList"></MyTable>
    
  </div>
</template>

<style scoped>
 
</style>

<script>
import MyTable from './components/MyTable.vue';

export default {
  components:{
    MyTable
  },
  data() {
    return {
      isShow:false,
      selectText:'',
      sickList:[
        {time:'2020-12-12',doctor:'时透无一郎',sick:'感冒',state:'健康'},
        {time:'2020-08-20',doctor:'富冈义勇',sick:'头痛',state:'健康'},
        {time:'2023-10-03',doctor:'伊黑小芭内',sick:'发烧',state:'健康'},
        {time:'2020-05-04',doctor:'炼狱杏寿郎',sick:'癌症',state:'健康'},
        {time:'2020-11-12',doctor:'蝴蝶忍',sick:'绝症',state:'健康'},
      ]
    }
  },
  methods:{
    selectData() {
      if(this.selectText.trim() == '') return alert('不能为空')
      this.sickList = this.sickList.filter(item => item.doctor.includes(this.selectText) || item.sick.includes(this.selectText))
    }
  }
}
</script>
